﻿Imports TBS = System.Drawing.Design.IToolboxService, TBI = System.Drawing.Design.ToolboxItem
Imports F = System.Windows.Forms, V = Microsoft.VisualStudio, VS = Microsoft.VisualStudio.Shell, C = System.ComponentModel, DD = System.Drawing.Design

''' <summary>
''' 
''' </summary>
''' <remarks></remarks>
Public Class Mod_ToolBox
    Private Sub New()
    End Sub

    Public Shared Function Get_ToolBox() As TBS
        Return Mod_Package.Get_Service(GetType(TBS))
    End Function


    Public Shared Function Create_ToolBoxItem()
        Dim New_ToolItem As New System.Drawing.Design.ToolboxItem()
        Get_ToolBox.GetToolboxItems()
    End Function




    Public Shared Sub Clean_ToolBox(ByVal ToolBox As TBS)
        Dim _Type = ToolBox.GetType
        Dim InterfaceList = ToolBox.GetType.GetInterfaces


        Dim T2 As ComponentModel.Design.IComponentDiscoveryService = ToolBox
        Dim T3 As V.Shell.Interop.IVsToolboxDataProvider = ToolBox



        Dim List As New List(Of TBI)
        For Each Item As TBI In ToolBox.GetToolboxItems
            If Item.DisplayName = "Button" Then
                List.Add(Item)
            End If
        Next
        For Each Item In List
            ToolBox.RemoveToolboxItem(Item)
        Next


        Dim Item1 As New TBI
        Item1.TypeName = GetType(F.Button).FullName
        Item1.DisplayName = "Button"
        ToolBox.RemoveToolboxItem(Item1)

    End Sub





End Class

Public Class ToolBarWrapper
    Inherits System.Drawing.Design.ToolboxService
    Implements TBS
    Private Property ToolBox As TBS


    Sub New(ByRef ToolBox As TBS)
        Me.ToolBox = ToolBox
    End Sub


    Protected Overrides ReadOnly Property CategoryNames As System.Drawing.Design.CategoryNameCollection
        Get
            Return ToolBox.CategoryNames
        End Get
    End Property

    Protected Overloads Overrides Function GetItemContainers() As System.Collections.IList
        Return CType(ToolBox, Object).GetItemContainers
    End Function

    Protected Overloads Overrides Function GetItemContainers(ByVal categoryName As String) As System.Collections.IList
        Return CType(ToolBox, Object).GetItemContainers(categoryName)
    End Function

    Protected Overrides Sub Refresh()
        ToolBox.Refresh()
    End Sub

    Protected Overrides Property SelectedCategory As String
        Get
            Return ToolBox.SelectedCategory
        End Get
        Set(ByVal value As String)
            ToolBox.SelectedCategory = value
        End Set
    End Property

    Protected Overrides Property SelectedItemContainer As System.Drawing.Design.ToolboxItemContainer
        Get
            Return CType(ToolBox, Object).SelectedItemContainer
        End Get
        Set(ByVal value As System.Drawing.Design.ToolboxItemContainer)
            CType(ToolBox, Object).SelectedItemContainer = value
        End Set
    End Property
End Class